<!doctype html public "-//W3C//DTD HTML 4.0 Frameset//EN""http://www.w3.org/TR/REC-html40/frameset.dtd">
<html>
<head>
<title>
Zapatec Utils Overview
</title>
<link rel ="stylesheet" type="text/css" href="../../../zapatec/utils/jsdocs/stylesheet.css" title="Style">
<script>
function asd() {
	
		parent.document.title="tree.js Overview";
	
}
</script>
</head>
<body bgcolor="white" onLoad="asd();">

<!-- ========== START OF NAVBAR ========== -->
<a name="navbar_top"><!-- --></a>
<table border="0" width="100%" cellpadding="1" cellspacing="0">
<tr>
<td colspan=2 bgcolor="#EEEEFF" class="NavBarCell1">
<a name="navbar_top_firstrow"><!-- --></a>
<table border="0" cellpadding="0" cellspacing="3">
  <tr align="center" valign="top">
  
  
  <td bgcolor="#EEEEFF" class="NavBarCell1">    <a href="../../../zapatec/utils/jsdocs/overview-summary.html"><font class="NavBarFont1"><b>Overview</b></font></a>&nbsp;</td>
  <td bgcolor="#FFFFFF" class="NavBarCell1Rev">	&nbsp;<font class="NavBarFont1Rev"><b>File</b></font>&nbsp;</td>
  

  <td bgcolor="#FFFFFF" class="NavBarCell1"> 	<font class="NavBarFont1">Class</font>&nbsp;</td>
  <td bgcolor="#EEEEFF" class="NavBarCell1">    <a href="../../../zapatec/utils/jsdocs/overview-tree.html"><font class="NavBarFont1"><b>Tree</b></font></a>&nbsp;</td>
  <td bgcolor="#EEEEFF" class="NavBarCell1">    <a href="../../../zapatec/utils/jsdocs/index-all.html"--><font class="NavBarFont1"><b>Index</b></font></a>&nbsp;</td>
  <td bgcolor="#EEEEFF" class="NavBarCell1">    <a href="../../../zapatec/utils/jsdocs/help-doc.html"><font class="NavBarFont1"><b>Help</b></font></a>&nbsp;</td>
  </tr>
</table>
</td>
<td bgcolor="#EEEEFF" align="right" valign="top">
<em>
<b>Zapatec Utils</b></em>
</td>
</tr>

<tr>
<td bgcolor="white" class="NavBarCell2"><font size="-2">
&nbsp;PREV&nbsp;
&nbsp;NEXT</font></td>
<td bgcolor="white" class="NavBarCell2"><font size="-2">
  <a href="../../../zapatec/utils/jsdocs/index.html" target="_top"><b>FRAMES</b></a>  &nbsp;
&nbsp;<a href="../../../zapatec/utils/jsdocs/overview-summary.html" target="_top"><b>NO FRAMES</b></a>
&nbsp;&nbsp;
<script>
  <!--
  if(window==top) {
    document.writeln('<A HREF="allclasses-noframe.html" TARGET=""><B>All Classes</B></A>');
  }
  //-->
</script>
<noscript>
<a href="../../../zapatec/utils/jsdocs/allclasses-noframe.html" target=""><b>All Classes</b></a>
</noscript>
</font></td>
</tr>
</table>
<!-- =========== END OF NAVBAR =========== -->

<hr>
<center>
	
	   <h2>tree.js</h2>
	
</center>

	


<h4>Summary</h4>
<p>
	
		No overview generated for 'tree.js'<BR/><BR/>
	
</p>

<hr>


    <table border="1" cellpadding="3" cellspacing="0" width="100%">
    <tr bgcolor="#CCCCFF" class="TableHeadingColor">
    <td colspan=2><font size="+2">
    
        <b>Class Summary</b>
    
    </font></td>
    </tr>
    
    <tr bgcolor="white" class="TableRowColor">
    <td width="15%"><b><a href="../../../zapatec/utils/jsdocs/Zapatec/BasicTree.html">Zapatec.BasicTree</a></b></td>
    <td>&nbsp;</td>
    </tr>
    
    <tr bgcolor="white" class="TableRowColor">
    <td width="15%"><b><a href="../../../zapatec/utils/jsdocs/Zapatec/Tree.html">Zapatec.Tree</a></b></td>
    <td>&nbsp;</td>
    </tr>
    
    <tr bgcolor="white" class="TableRowColor">
    <td width="15%"><b><a href="../../../zapatec/utils/jsdocs/Zapatec/Tree/Node.html">Zapatec.Tree.Node</a></b></td>
    <td>&nbsp;</td>
    </tr>
    
    </table>
    <hr/> 


<!-- ========== METHOD SUMMARY =========== -->

<!-- ========== END METHOD SUMMARY =========== -->


        <pre class="sourceview"><span class="comment">/*
 *
 * Copyright (c) 2004-2005 by Zapatec, Inc.
 * http://www.zapatec.com
 * 1700 MLK Way, Berkeley, California,
 * 94709, U.S.A.
 * All rights reserved.
 *
 *
 */</span>
Zapatec.treePath = Zapatec.getPath(<span class="literal">"Zapatec.Tree"</span>);

Zapatec.Tree=<span class="reserved">function</span>(){var objArgs={};switch(arguments.length){case 1:objArgs=arguments[0];break;case 2:objArgs=arguments[1];objArgs.tree=arguments[0];break;}
Zapatec.Tree.SUPERconstructor.call(<span class="reserved">this</span>,objArgs);};Zapatec.Tree.id=<span class="literal">"Zapatec.Tree"</span>;Zapatec.Tree.all={};Zapatec.inherit(Zapatec.Tree,Zapatec.Widget);Zapatec.Tree.<span class="reserved">prototype</span>.init=<span class="reserved">function</span>(config){<span class="reserved">this</span>.container=null;<span class="reserved">this</span>.internalContainer=null;<span class="reserved">this</span>.allNodes=[];<span class="reserved">this</span>.id2Obj={};<span class="reserved">this</span>.rootNode=null;<span class="reserved">this</span>.expandToLevelNum=0;<span class="reserved">this</span>.isClicked=false;<span class="reserved">this</span>.isActive=false;<span class="reserved">this</span>.editInline=null;<span class="reserved">this</span>.isSaveStateDone=false;<span class="reserved">if</span>(config.tree){var tmp=Zapatec.Widget.getElementById(config.tree);<span class="reserved">if</span>(tmp&amp;&amp;tmp.id){<span class="reserved">this</span>.id=tmp.id;}}
Zapatec.Tree.SUPERclass.init.call(<span class="reserved">this</span>,config);Zapatec.Tree.all[<span class="reserved">this</span>.id]=<span class="reserved">this</span>;<span class="reserved">this</span>.container=Zapatec.Utils.createElement(<span class="literal">"div"</span>,null,<span class="reserved">this</span>.config.selectable);<span class="reserved">this</span>.container.className=<span class="reserved">this</span>.getClassName({prefix:<span class="literal">"zpTree"</span>,suffix:<span class="literal">"Container"</span>});<span class="reserved">this</span>.container.id=<span class="literal">"zpTree"</span>+<span class="reserved">this</span>.id+<span class="literal">"Container"</span>;<span class="reserved">this</span>.internalContainer=Zapatec.Utils.createElement(<span class="literal">"div"</span>,null,<span class="reserved">this</span>.config.selectable);<span class="reserved">this</span>.internalContainer.className=<span class="literal">"tree tree-top"</span>;<span class="reserved">this</span>.container.appendChild(<span class="reserved">this</span>.internalContainer);Zapatec.Utils.createProperty(<span class="reserved">this</span>.container,<span class="literal">"zpTree"</span>,<span class="reserved">this</span>);<span class="reserved">if</span>(<span class="reserved">this</span>.config.initLevel){<span class="reserved">this</span>.expandToLevelNum=<span class="reserved">this</span>.config.initLevel;}
<span class="reserved">if</span>(<span class="reserved">this</span>.config.tree){<span class="reserved">this</span>.config.tree.parentNode.insertBefore(<span class="reserved">this</span>.container,<span class="reserved">this</span>.config.tree);Zapatec.Utils.destroy(<span class="reserved">this</span>.config.tree);}<span class="reserved">else</span> <span class="reserved">if</span>(<span class="reserved">this</span>.config.parent){<span class="reserved">this</span>.config.parent.appendChild(<span class="reserved">this</span>.container);}
<span class="reserved">this</span>.rootNode=new Zapatec.Tree.Node({tree:<span class="reserved">this</span>,parentNode:null,level:0,isRootNode:true,eventListeners:<span class="reserved">this</span>.config.eventListeners});<span class="reserved">this</span>.id2Obj[<span class="reserved">this</span>.id]=<span class="reserved">this</span>.rootNode;<span class="reserved">this</span>.rootNode.isCreated=true;<span class="reserved">this</span>.rootNode.childrenContainer=<span class="reserved">this</span>.internalContainer;<span class="reserved">this</span>.prevSelected=null;<span class="reserved">this</span>.loadData();<span class="reserved">if</span>(<span class="reserved">this</span>.prevSelected){<span class="reserved">this</span>.sync(<span class="reserved">this</span>.prevSelected.id);}
<span class="reserved">if</span>(<span class="reserved">this</span>.config.saveState){var txt=Zapatec.Utils.getCookie(<span class="literal">"Zapatec.Tree-"</span>+<span class="reserved">this</span>.config.saveId);var node=<span class="reserved">this</span>.getNode(txt,true);<span class="reserved">if</span>(node){<span class="reserved">this</span>.isSaveStateDone=true;node.sync();}}
<span class="reserved">if</span>(<span class="reserved">this</span>.config.editable){<span class="reserved">if</span>(Zapatec.EditInline){var self=<span class="reserved">this</span>;<span class="reserved">this</span>.editInline=new Zapatec.EditInline({editAsText:<span class="reserved">this</span>.config.editAsText,eventListeners:{showStart:<span class="reserved">function</span>(){<span class="reserved">this</span>.selectedNode=self.prevSelected;},saveContent:<span class="reserved">function</span>(content){<span class="reserved">if</span>(<span class="reserved">this</span>.selectedNode){<span class="reserved">this</span>.selectedNode.rename(content);<span class="reserved">this</span>.selectedNode=null;}}}});}<span class="reserved">else</span>{<span class="reserved">this</span>.config.editable=false;Zapatec.Log({description:<span class="literal">"Zapatec.EditInline class is not found. Please include 'utils/edit_inline.js' into page."</span>});}}
<span class="reserved">this</span>.attachNavigation();};Zapatec.Tree.<span class="reserved">prototype</span>.configure=<span class="reserved">function</span>(objArgs){<span class="reserved">this</span>.defineConfigOption(<span class="literal">'tree'</span>);<span class="reserved">this</span>.defineConfigOption(<span class="literal">'parent'</span>);<span class="reserved">this</span>.defineConfigOption(<span class="literal">'hiliteSelectedNode'</span>);<span class="reserved">this</span>.defineConfigOption(<span class="literal">'highlightSelectedNode'</span>,true);<span class="reserved">this</span>.defineConfigOption(<span class="literal">'defaultIcons'</span>);<span class="reserved">this</span>.defineConfigOption(<span class="literal">'compact'</span>,false);<span class="reserved">this</span>.defineConfigOption(<span class="literal">'dynamic'</span>,false);<span class="reserved">this</span>.defineConfigOption(<span class="literal">'initLevel'</span>,1);<span class="reserved">this</span>.defineConfigOption(<span class="literal">'deselectSelected'</span>,false);<span class="reserved">this</span>.defineConfigOption(<span class="literal">'saveState'</span>,false);<span class="reserved">this</span>.defineConfigOption(<span class="literal">'saveId'</span>);<span class="reserved">this</span>.defineConfigOption(<span class="literal">'expandOnSignClick'</span>,true);<span class="reserved">this</span>.defineConfigOption(<span class="literal">'expandOnSignDblclick'</span>,false);<span class="reserved">this</span>.defineConfigOption(<span class="literal">'expandOnIconClick'</span>,true);<span class="reserved">this</span>.defineConfigOption(<span class="literal">'expandOnIconDblclick'</span>,false);<span class="reserved">this</span>.defineConfigOption(<span class="literal">'expandOnLabel'</span>);<span class="reserved">this</span>.defineConfigOption(<span class="literal">'expandOnLabelClick'</span>,false);<span class="reserved">this</span>.defineConfigOption(<span class="literal">'labelDblClick'</span>);<span class="reserved">this</span>.defineConfigOption(<span class="literal">'expandOnLabelDblclick'</span>,false);<span class="reserved">this</span>.defineConfigOption(<span class="literal">'selectMultiple'</span>,false);<span class="reserved">this</span>.defineConfigOption(<span class="literal">'selectOnSignClick'</span>,true);<span class="reserved">this</span>.defineConfigOption(<span class="literal">'selectOnSignDblclick'</span>,true);<span class="reserved">this</span>.defineConfigOption(<span class="literal">'selectOnIconClick'</span>,true);<span class="reserved">this</span>.defineConfigOption(<span class="literal">'selectOnIconDblclick'</span>,true);<span class="reserved">this</span>.defineConfigOption(<span class="literal">'selectOnLabelClick'</span>,true);<span class="reserved">this</span>.defineConfigOption(<span class="literal">'selectOnLabelDblclick'</span>,true);<span class="reserved">this</span>.defineConfigOption(<span class="literal">'prevCompatible'</span>,false);<span class="reserved">this</span>.defineConfigOption(<span class="literal">'quick'</span>,false);<span class="reserved">this</span>.defineConfigOption(<span class="literal">'putBackReferences'</span>,false);<span class="reserved">this</span>.defineConfigOption(<span class="literal">'createWholeDOM'</span>,false);<span class="reserved">this</span>.defineConfigOption(<span class="literal">'jsonLoadCallback'</span>);<span class="reserved">this</span>.defineConfigOption(<span class="literal">'keyboardNavigation'</span>,false);<span class="reserved">this</span>.defineConfigOption(<span class="literal">'deselectOnLeave'</span>);<span class="reserved">this</span>.defineConfigOption(<span class="literal">'putCheckboxes'</span>,false);<span class="reserved">this</span>.defineConfigOption(<span class="literal">'dependantCheckboxes'</span>,true);<span class="reserved">this</span>.defineConfigOption(<span class="literal">'selectable'</span>,false);<span class="reserved">this</span>.defineConfigOption(<span class="literal">'editable'</span>,false);<span class="reserved">this</span>.defineConfigOption(<span class="literal">'editAsText'</span>,true);<span class="reserved">this</span>.defineConfigOption(<span class="literal">'editOnClick'</span>,false);<span class="reserved">this</span>.defineConfigOption(<span class="literal">'editOnDblclick'</span>,true);<span class="reserved">this</span>.defineConfigOption(<span class="literal">'disableContextMenu'</span>,false);Zapatec.Tree.SUPERclass.configure.call(<span class="reserved">this</span>,objArgs);<span class="reserved">this</span>.config.parent=Zapatec.Widget.getElementById(<span class="reserved">this</span>.config.parent);<span class="reserved">this</span>.config.tree=Zapatec.Widget.getElementById(<span class="reserved">this</span>.config.tree);<span class="reserved">if</span>(<span class="reserved">this</span>.config.tree!=null){<span class="reserved">if</span>(<span class="reserved">this</span>.config.source==null){<span class="reserved">this</span>.config.source=<span class="reserved">this</span>.config.tree;}<span class="reserved">else</span>{}}
<span class="reserved">if</span>(typeof(<span class="reserved">this</span>.config.hiliteSelectedNode)!=<span class="literal">'undefined'</span>&amp;&amp;<span class="reserved">this</span>.config.hiliteSelectedNode!=null){<span class="reserved">this</span>.config.highlightSelectedNode=<span class="reserved">this</span>.config.hiliteSelectedNode;}
<span class="reserved">if</span>(<span class="reserved">this</span>.config.parent==null&amp;&amp;<span class="reserved">this</span>.config.tree==null){Zapatec.Log({description:<span class="literal">"No 'parent' or 'tree' config options given. Unable to add tree."</span>});throw(<span class="literal">"No 'parent' or 'tree' config options given. Unable to add tree."</span>);}
<span class="reserved">if</span>(<span class="reserved">this</span>.config.labelDblClick!=null){<span class="reserved">this</span>.config.expandOnLabelDblclick=<span class="reserved">this</span>.config.labelDblClick;}
<span class="reserved">if</span>(<span class="reserved">this</span>.config.expandOnLabel!=null){<span class="reserved">this</span>.config.expandOnLabelClick=<span class="reserved">this</span>.config.expandOnLabel;}
<span class="reserved">if</span>(<span class="reserved">this</span>.config.initLevel==false){<span class="reserved">this</span>.config.initLevel=1;}
<span class="reserved">if</span>(<span class="reserved">this</span>.config.initLevel&lt;1){<span class="reserved">this</span>.config.initLevel=1;}
<span class="reserved">if</span>(<span class="reserved">this</span>.config.saveState&amp;&amp;(!<span class="reserved">this</span>.config.saveId||typeof(<span class="reserved">this</span>.config.saveId)!=<span class="literal">'string'</span>||<span class="reserved">this</span>.config.saveId.length==0)){Zapatec.Log({description:<span class="literal">"No 'saveId' is given. 'saveState' feature disabled."</span>});<span class="reserved">this</span>.config.saveState=false;}
<span class="reserved">if</span>(<span class="reserved">this</span>.config.createWholeDOM&amp;&amp;<span class="reserved">this</span>.config.quick){<span class="reserved">this</span>.config.quick=false;Zapatec.Log({description:<span class="literal">"Config option 'createWholeDOM' overrides 'quick' config option"</span>});}
<span class="reserved">if</span>(<span class="reserved">this</span>.config.selectMultiple){<span class="reserved">this</span>.config.keyboardNavigation=false;}
<span class="reserved">if</span>(<span class="reserved">this</span>.config.keyboardNavigation&amp;&amp;typeof(<span class="reserved">this</span>.config.deselectOnLeave)==<span class="literal">'undefined'</span>){<span class="reserved">this</span>.config.deselectOnLeave=true;}
<span class="reserved">if</span>(!<span class="reserved">this</span>.config.putCheckboxes){<span class="reserved">this</span>.config.dependantCheckboxes=false;}};Zapatec.Tree.<span class="reserved">prototype</span>.reconfigure=<span class="reserved">function</span>(objArgs){<span class="reserved">if</span>(objArgs.theme){Zapatec.Utils.removeClass(<span class="reserved">this</span>.container,<span class="reserved">this</span>.getClassName({prefix:<span class="literal">"zpTree"</span>,suffix:<span class="literal">"Container"</span>}));}
Zapatec.Tree.SUPERclass.reconfigure.call(<span class="reserved">this</span>,objArgs);Zapatec.Utils.addClass(<span class="reserved">this</span>.container,<span class="reserved">this</span>.getClassName({prefix:<span class="literal">"zpTree"</span>,suffix:<span class="literal">"Container"</span>}));};Zapatec.Tree.<span class="reserved">prototype</span>.addStandardEventListeners=<span class="reserved">function</span>(){Zapatec.Tree.SUPERclass.addStandardEventListeners.call(<span class="reserved">this</span>);<span class="reserved">this</span>.addEventListener(<span class="literal">'fetchSourceError'</span>,<span class="reserved">this</span>.displayErrorSource);};Zapatec.Tree.<span class="reserved">prototype</span>.displayErrorSource=<span class="reserved">function</span>(oError){alert(<span class="literal">"The tree's data source, "</span>+<span class="reserved">this</span>.config.source+<span class="literal">" does not contain valid data.\n"</span>+oError.errorDescription);};Zapatec.Tree.<span class="reserved">prototype</span>.find=<span class="reserved">function</span>(findFunc){<span class="reserved">for</span>(var ii=0;ii&lt;<span class="reserved">this</span>.allNodes.length;ii++){<span class="reserved">if</span>(findFunc(<span class="reserved">this</span>.allNodes[ii])){<span class="reserved">return</span> <span class="reserved">this</span>.allNodes[ii];}}};Zapatec.Tree.<span class="reserved">prototype</span>.findAll=<span class="reserved">function</span>(findFunc){var result=[];<span class="reserved">for</span>(var ii=0;ii&lt;<span class="reserved">this</span>.allNodes.length;ii++){<span class="reserved">if</span>(findFunc(<span class="reserved">this</span>.allNodes[ii])){result.push(<span class="reserved">this</span>.allNodes[ii]);}}
<span class="reserved">return</span> result;};Zapatec.Tree.<span class="reserved">prototype</span>.toggleAll=<span class="reserved">function</span>(){<span class="reserved">for</span>(var ii=0;ii&lt;<span class="reserved">this</span>.allNodes.length;ii++){<span class="reserved">this</span>.allNodes[ii].toggle();}};Zapatec.Tree.<span class="reserved">prototype</span>.getNode=<span class="reserved">function</span>(id,omitWarning){var node=<span class="reserved">this</span>.id2Obj[id];<span class="reserved">if</span>(node==null){<span class="reserved">if</span>(!omitWarning){Zapatec.Log({description:<span class="literal">"No node found for id '"</span>+id+<span class="literal">"'"</span>});}
<span class="reserved">return</span>;}
<span class="reserved">return</span> node;};Zapatec.Tree.<span class="reserved">prototype</span>.sync=<span class="reserved">function</span>(itemId){var node=<span class="reserved">this</span>.getNode(itemId);<span class="reserved">if</span>(node){node.sync();}};Zapatec.Tree.<span class="reserved">prototype</span>.toggleItem=<span class="reserved">function</span>(nodeId,state){var node=<span class="reserved">this</span>.getNode(nodeId);<span class="reserved">if</span>(!node){<span class="reserved">return</span>;}
<span class="reserved">if</span>(state==true){node.expand();}<span class="reserved">else</span> <span class="reserved">if</span>(state==false){node.collapse();}<span class="reserved">else</span> <span class="reserved">if</span>(state==null){node.toggle();}};Zapatec.Tree.<span class="reserved">prototype</span>.appendChild=<span class="reserved">function</span>(newChild,parent,atStart){<span class="reserved">if</span>(<span class="reserved">this</span>.config.prevCompatible){var tmp=parent;parent=newChild;newChild=tmp;}
<span class="reserved">if</span>(parent==null){parent=<span class="reserved">this</span>.rootNode;}<span class="reserved">else</span>{parent=<span class="reserved">this</span>.getNode(parent);}
<span class="reserved">if</span>(parent==null){<span class="reserved">return</span> null;}
<span class="reserved">return</span> parent.appendChild(newChild,atStart);};Zapatec.Tree.<span class="reserved">prototype</span>.insertBefore=<span class="reserved">function</span>(newChild,refChild){refChild=<span class="reserved">this</span>.getNode(refChild);<span class="reserved">if</span>(refChild==null){<span class="reserved">return</span> null;}
<span class="reserved">return</span> refChild.insertBefore(newChild);};Zapatec.Tree.<span class="reserved">prototype</span>.insertAfter=<span class="reserved">function</span>(newChild,refChild){refChild=<span class="reserved">this</span>.getNode(refChild);<span class="reserved">if</span>(refChild==null){<span class="reserved">return</span> null;}
<span class="reserved">return</span> refChild.insertAfter(newChild);};Zapatec.Tree.<span class="reserved">prototype</span>.removeChild=<span class="reserved">function</span>(oldChild){oldChild=<span class="reserved">this</span>.getNode(oldChild);<span class="reserved">if</span>(oldChild==null){<span class="reserved">return</span> null;}
oldChild.destroy();};Zapatec.Tree.<span class="reserved">prototype</span>.collapseAll=<span class="reserved">function</span>(){<span class="reserved">for</span>(var ii=0;ii&lt;<span class="reserved">this</span>.allNodes.length;ii++){<span class="reserved">this</span>.allNodes[ii].collapse();}};Zapatec.Tree.<span class="reserved">prototype</span>.collapseToLevel=<span class="reserved">function</span>(level){<span class="reserved">for</span>(var ii=0;ii&lt;<span class="reserved">this</span>.allNodes.length;ii++){<span class="reserved">if</span>(<span class="reserved">this</span>.allNodes[ii].config.level&gt;level){<span class="reserved">this</span>.allNodes[ii].collapse();}}};Zapatec.Tree.<span class="reserved">prototype</span>.expandAll=<span class="reserved">function</span>(){<span class="reserved">for</span>(var ii=0;ii&lt;<span class="reserved">this</span>.allNodes.length;ii++){<span class="reserved">this</span>.allNodes[ii].expand();}};Zapatec.Tree.<span class="reserved">prototype</span>.expandToLevel=<span class="reserved">function</span>(level){<span class="reserved">this</span>.expandToLevelNum=level;<span class="reserved">for</span>(var ii=0;ii&lt;<span class="reserved">this</span>.allNodes.length;ii++){<span class="reserved">if</span>(<span class="reserved">this</span>.allNodes[ii].config.level&lt;=level){<span class="reserved">this</span>.allNodes[ii].expand();}}};Zapatec.Tree.<span class="reserved">prototype</span>.loadDataJson=<span class="reserved">function</span>(objResponse){<span class="reserved">if</span>(objResponse==null){<span class="reserved">return</span> null;}
<span class="reserved">if</span>(<span class="reserved">this</span>.config.jsonLoadCallback){objResponse=<span class="reserved">this</span>.config.jsonLoadCallback(objResponse);}
<span class="reserved">this</span>.rootNode.data={};<span class="reserved">this</span>.rootNode.data.children=objResponse;<span class="reserved">this</span>.rootNode.createChildren();<span class="reserved">for</span>(var ii=0;ii&lt;<span class="reserved">this</span>.rootNode.children.length;ii++){<span class="reserved">this</span>.rootNode.children[ii].afterCreate();}
<span class="reserved">if</span>(<span class="reserved">this</span>.config.saveState&amp;&amp;!<span class="reserved">this</span>.isSaveStateDone){var txt=Zapatec.Utils.getCookie(<span class="literal">"Zapatec.Tree-"</span>+<span class="reserved">this</span>.config.saveId);var node=<span class="reserved">this</span>.getNode(txt,true);<span class="reserved">if</span>(node){<span class="reserved">this</span>.isSaveStateDone=true;node.sync();}}};Zapatec.Tree.<span class="reserved">prototype</span>.loadDataXml=<span class="reserved">function</span>(objSource){<span class="reserved">if</span>(objSource==null||objSource.documentElement==null){<span class="reserved">return</span> null;}
var result=[];<span class="reserved">for</span>(var jj=0;jj&lt;objSource.documentElement.childNodes.length;jj++){var tmp=Zapatec.Tree.Utils.convertXml2Json(objSource.documentElement.childNodes[jj]);<span class="reserved">if</span>(tmp!=null){result.push(tmp);}}
<span class="reserved">return</span> <span class="reserved">this</span>.loadDataJson(result);};Zapatec.Tree.<span class="reserved">prototype</span>.loadDataHtml=<span class="reserved">function</span>(objSource){<span class="reserved">if</span>(objSource==null){<span class="reserved">return</span> null;}
var result=[];<span class="reserved">for</span>(var jj=0;jj&lt;objSource.childNodes.length;jj++){var tmp=Zapatec.Tree.Utils.convertLi2Json(objSource.childNodes[jj],<span class="reserved">this</span>.config.prevCompatible);<span class="reserved">if</span>(tmp!=null){result.push(tmp);}}
<span class="reserved">return</span> <span class="reserved">this</span>.loadDataJson(result);};Zapatec.Tree.<span class="reserved">prototype</span>.makeNode=<span class="reserved">function</span>(html,type){<span class="reserved">if</span>(!type){type=<span class="literal">"li"</span>;}
var node=Zapatec.Utils.createElement(type);<span class="reserved">if</span>(html){Zapatec.Transport.setInnerHtml({html:html,container:node});}
<span class="reserved">return</span> node;};Zapatec.Tree.<span class="reserved">prototype</span>.destroy=<span class="reserved">function</span>(leaveDOM){<span class="reserved">this</span>.rootNode.destroy(true);<span class="reserved">this</span>.container.zpTree=null;Zapatec.Tree.all[<span class="reserved">this</span>.id]=null;<span class="reserved">this</span>.allNodes=null;<span class="reserved">this</span>.rootNode=null;<span class="reserved">if</span>(!leaveDOM){Zapatec.Utils.destroy(<span class="reserved">this</span>.container);}
<span class="reserved">this</span>.container=null;<span class="reserved">this</span>.id2Obj=null;<span class="reserved">this</span>.discard();};Zapatec.Tree.<span class="reserved">prototype</span>.onItemSelect=<span class="reserved">function</span>(){};Zapatec.Tree.<span class="reserved">prototype</span>.getState=<span class="reserved">function</span>(){var result=[];<span class="reserved">for</span>(var ii=0;ii&lt;<span class="reserved">this</span>.rootNode.children.length;ii++){result.push(<span class="reserved">this</span>.rootNode.children[ii].getState());}
<span class="reserved">return</span> result;};Zapatec.Tree.<span class="reserved">prototype</span>.getParent=<span class="reserved">function</span>(id,mode){<span class="reserved">return</span> id;};Zapatec.Tree.<span class="reserved">prototype</span>.attachNavigation=<span class="reserved">function</span>(){var self=<span class="reserved">this</span>;Zapatec.Utils.addEvent(<span class="reserved">this</span>.container,<span class="literal">"click"</span>,<span class="reserved">function</span>(){self.isActive=true;self.isClicked=true;});Zapatec.Utils.addEvent(document,(Zapatec.is_ie?<span class="literal">"keydown"</span>:<span class="literal">"keypress"</span>),<span class="reserved">function</span>(evt){<span class="reserved">return</span> self.keyEvent(evt);});Zapatec.Utils.addEvent(document,<span class="literal">'click'</span>,<span class="reserved">function</span>(){<span class="reserved">if</span>(!self.isClicked){self.leave();}
self.isClicked=false;});};Zapatec.Tree.<span class="reserved">prototype</span>.keyEvent=<span class="reserved">function</span>(evt){<span class="reserved">if</span>(!<span class="reserved">this</span>.prevSelected||!<span class="reserved">this</span>.isActive){<span class="reserved">return</span> true;}
<span class="reserved">if</span>(!evt){evt=window.event;}
<span class="reserved">if</span>(!<span class="reserved">this</span>.config.keyboardNavigation&amp;&amp;!<span class="reserved">this</span>.config.editable){<span class="reserved">return</span>;}
var res=Zapatec.Utils.getCharFromEvent(evt);<span class="reserved">this</span>.fireEvent(<span class="literal">"keypressed"</span>,res.charCode,res.chr);<span class="reserved">if</span>(res.charCode==27){<span class="reserved">this</span>.leave();}
<span class="reserved">if</span>(res.chr==<span class="literal">" "</span>){res.charCode=32;}
<span class="reserved">if</span>(<span class="reserved">this</span>.config.keyboardNavigation&amp;&amp;(!<span class="reserved">this</span>.config.editable||<span class="reserved">this</span>.config.editable&amp;&amp;!<span class="reserved">this</span>.editInline&amp;&amp;!<span class="reserved">this</span>.editInline.selectedNode)){switch(res.charCode){case 32:<span class="reserved">if</span>(<span class="reserved">this</span>.config.putCheckboxes){<span class="reserved">this</span>.prevSelected.checkboxChanged();}
case 13:<span class="reserved">this</span>.prevSelected.toggle();Zapatec.Utils.stopEvent(evt);break;case 63234:case 37:<span class="reserved">if</span>(<span class="reserved">this</span>.prevSelected.data.isExpanded){<span class="reserved">this</span>.prevSelected.collapse();}<span class="reserved">else</span>{<span class="reserved">if</span>(!<span class="reserved">this</span>.prevSelected.config.parentNode.isRootNode){<span class="reserved">this</span>.prevSelected.config.parentNode.select();}}
break;case 63235:case 39:<span class="reserved">if</span>(!<span class="reserved">this</span>.prevSelected.data.isExpanded){<span class="reserved">this</span>.prevSelected.expand();}<span class="reserved">else</span>{<span class="reserved">if</span>(<span class="reserved">this</span>.prevSelected.children!=null&amp;&amp;<span class="reserved">this</span>.prevSelected.children.length&gt;0){<span class="reserved">this</span>.prevSelected.children[0].select();}}
break;case 63232:case 38:var prevNode=Zapatec.Tree.Utils.getPrevNode(<span class="reserved">this</span>.prevSelected);<span class="reserved">if</span>(prevNode){prevNode.select();Zapatec.Utils.stopEvent(evt);}
break;case 63233:case 40:var nextNode=Zapatec.Tree.Utils.getNextNode(<span class="reserved">this</span>.prevSelected);<span class="reserved">if</span>(nextNode){nextNode.select();Zapatec.Utils.stopEvent(evt);}
break;}}
<span class="reserved">if</span>(<span class="reserved">this</span>.config.editable&amp;&amp;<span class="reserved">this</span>.editInline.selectedNode){<span class="reserved">if</span>(res.charCode==9){var otherNode=null;<span class="reserved">if</span>(evt.shiftKey){otherNode=Zapatec.Tree.Utils.getPrevNode(<span class="reserved">this</span>.editInline.selectedNode);}<span class="reserved">else</span>{otherNode=Zapatec.Tree.Utils.getNextNode(<span class="reserved">this</span>.editInline.selectedNode);}
<span class="reserved">if</span>(otherNode){<span class="reserved">this</span>.editInline.saveAndHide();otherNode.select();<span class="reserved">this</span>.editInline.show(otherNode.getLinkToLabelElement());Zapatec.Utils.stopEvent(evt);}}}};Zapatec.Tree.<span class="reserved">prototype</span>.leave=<span class="reserved">function</span>(){<span class="reserved">if</span>(<span class="reserved">this</span>.prevSelected&amp;&amp;<span class="reserved">this</span>.config.deselectOnLeave){<span class="reserved">this</span>.prevSelected.deselect();}
<span class="reserved">this</span>.isActive=false;<span class="reserved">this</span>.fireEvent(<span class="literal">"leave"</span>);};Zapatec.Tree.Node=<span class="reserved">function</span>(objArgs){Zapatec.Tree.Node.SUPERconstructor.call(<span class="reserved">this</span>,objArgs);};Zapatec.Tree.Node.id=<span class="literal">"Zapatec.Tree.Node"</span>;Zapatec.inherit(Zapatec.Tree.Node,Zapatec.Widget);Zapatec.Tree.Node.<span class="reserved">prototype</span>.configure=<span class="reserved">function</span>(objArgs){<span class="reserved">this</span>.defineConfigOption(<span class="literal">'theme'</span>,null);<span class="reserved">this</span>.defineConfigOption(<span class="literal">'tree'</span>,null);<span class="reserved">this</span>.defineConfigOption(<span class="literal">'parentNode'</span>,null);<span class="reserved">this</span>.defineConfigOption(<span class="literal">'level'</span>);<span class="reserved">this</span>.defineConfigOption(<span class="literal">'isRootNode'</span>,false);Zapatec.Tree.Node.SUPERclass.configure.call(<span class="reserved">this</span>,objArgs);<span class="reserved">if</span>(<span class="reserved">this</span>.config.tree==null){Zapatec.Log({description:<span class="literal">"No reference to parent Zapatec.Tree instance! Aborting."</span>});throw(<span class="literal">"No reference to parent Zapatec.Tree instance! Aborting."</span>);}};Zapatec.Tree.Node.<span class="reserved">prototype</span>.init=<span class="reserved">function</span>(config){<span class="reserved">this</span>.expandedIcon=null;<span class="reserved">this</span>.collapsedIcon=null;<span class="reserved">this</span>.fetchingIcon=null;<span class="reserved">this</span>.elementIcon=null;<span class="reserved">this</span>.isCreated=false;<span class="reserved">this</span>.isChildrenCreated=false;<span class="reserved">this</span>.isFetching=false;<span class="reserved">this</span>.data=null;<span class="reserved">this</span>.children=[];<span class="reserved">this</span>.labelContainer=null;<span class="reserved">this</span>.iconElement=null;<span class="reserved">this</span>.signElement=null;<span class="reserved">this</span>.childrenContainer=null;<span class="reserved">this</span>.checkboxContainer=null;<span class="reserved">this</span>.oldSource=null;<span class="reserved">this</span>.oldSourceType=null;Zapatec.Tree.Node.SUPERclass.init.call(<span class="reserved">this</span>,config);<span class="reserved">if</span>(!<span class="reserved">this</span>.config.isRootNode){<span class="reserved">this</span>.config.tree.allNodes.push(<span class="reserved">this</span>);}
<span class="reserved">this</span>.loadData();<span class="reserved">this</span>.config.source=null;<span class="reserved">this</span>.config.sourceType=null;<span class="reserved">if</span>(!<span class="reserved">this</span>.config.isRootNode){<span class="reserved">if</span>(<span class="reserved">this</span>.data.attributes&amp;&amp;<span class="reserved">this</span>.data.attributes[<span class="literal">'class'</span>]){var md=null;<span class="reserved">if</span>(md=<span class="reserved">this</span>.data.attributes[<span class="literal">'class'</span>].match(/zpLoad(JSON|HTML|XML)=([^ $]*)/)){<span class="reserved">this</span>.data.source=md[2];<span class="reserved">if</span>(md[1]==<span class="literal">"JSON"</span>){<span class="reserved">this</span>.data.sourceType=<span class="literal">"json/url"</span>;}<span class="reserved">else</span> <span class="reserved">if</span>(md[1]==<span class="literal">"HTML"</span>){<span class="reserved">this</span>.data.sourceType=<span class="literal">"html/url"</span>;}<span class="reserved">else</span> <span class="reserved">if</span>(md[1]==<span class="literal">"XML"</span>){<span class="reserved">this</span>.data.sourceType=<span class="literal">"xml/url"</span>;}<span class="reserved">else</span>{<span class="reserved">this</span>.data.source=null;<span class="reserved">this</span>.data.sourceType=null;}}}
<span class="reserved">if</span>(<span class="reserved">this</span>.data.source){<span class="reserved">if</span>(<span class="reserved">this</span>.data.children==null||<span class="reserved">this</span>.data.loadAlways){<span class="reserved">this</span>.data.children=[];}
<span class="reserved">this</span>.config.source=<span class="reserved">this</span>.data.source;<span class="reserved">this</span>.config.sourceType=<span class="reserved">this</span>.data.sourceType;}}};Zapatec.Tree.Node.<span class="reserved">prototype</span>.addStandardEventListeners=<span class="reserved">function</span>(){Zapatec.Tree.Node.SUPERclass.addStandardEventListeners.call(<span class="reserved">this</span>);<span class="reserved">this</span>.addEventListener(<span class="literal">'fetchSourceStart'</span>,<span class="reserved">function</span>(){<span class="reserved">this</span>.isFetching=true;<span class="reserved">this</span>.putIcons();});<span class="reserved">this</span>.addEventListener(<span class="literal">"fetchSourceEnd"</span>,<span class="reserved">function</span>(){<span class="reserved">this</span>.isFetching=false;<span class="reserved">this</span>.putIcons();});var tmpFunc=<span class="reserved">function</span>(){<span class="reserved">if</span>(<span class="reserved">this</span>.data&amp;&amp;<span class="reserved">this</span>.data.loadAlways){<span class="reserved">for</span>(var ii=<span class="reserved">this</span>.children.length-1;ii&gt;=0;ii--){<span class="reserved">this</span>.children[ii].destroy(true);}
<span class="reserved">this</span>.data.children=[];<span class="reserved">if</span>(<span class="reserved">this</span>.childrenContainer){<span class="reserved">this</span>.childrenContainer.innerHTML=<span class="literal">""</span>;}}};<span class="reserved">this</span>.addEventListener(<span class="literal">'loadDataStart'</span>,tmpFunc);<span class="reserved">this</span>.addEventListener(<span class="literal">'fetchSourceStart'</span>,tmpFunc);<span class="reserved">this</span>.addEventListener(<span class="literal">'loadDataEnd'</span>,<span class="reserved">function</span>(){<span class="reserved">this</span>.oldSource=<span class="reserved">this</span>.config.source;<span class="reserved">this</span>.oldSourceType=<span class="reserved">this</span>.config.sourceType;<span class="reserved">this</span>.config.source=null;<span class="reserved">this</span>.config.sourceType=null;<span class="reserved">if</span>(!<span class="reserved">this</span>.config.isRootNode&amp;&amp;<span class="reserved">this</span>.data.isExpanded){<span class="reserved">this</span>.expand();}
<span class="reserved">if</span>(<span class="reserved">this</span>.data&amp;&amp;<span class="reserved">this</span>.data.loadAlways){<span class="reserved">this</span>.config.source=<span class="reserved">this</span>.oldSource;<span class="reserved">this</span>.config.sourceType=<span class="reserved">this</span>.oldSourceType;}});<span class="reserved">this</span>.addEventListener(<span class="literal">"fetchSourceError"</span>,<span class="reserved">function</span>(objError){<span class="reserved">if</span>(<span class="reserved">this</span>.data&amp;&amp;<span class="reserved">this</span>.data.loadAlways){<span class="reserved">this</span>.config.source=<span class="reserved">this</span>.oldSourceType;<span class="reserved">this</span>.config.sourceType=<span class="reserved">this</span>.oldSourceType;}
Zapatec.Log({description:<span class="literal">"Error happend while retrieving branch content: "</span>+objError.errorCode+<span class="literal">" "</span>+objError.errorDescription});});};Zapatec.Tree.Node.<span class="reserved">prototype</span>.create=<span class="reserved">function</span>(){<span class="reserved">if</span>(<span class="reserved">this</span>.isCreated||<span class="reserved">this</span>.data==null||<span class="reserved">this</span>.config.isRootNode){<span class="reserved">return</span> null;}
<span class="reserved">this</span>.fireEvent(<span class="literal">"beforeCreate"</span>);var content=[];content.push(<span class="literal">"&lt;div class='tree-item"</span>);content.push(<span class="reserved">this</span>.hasSubtree()?<span class="literal">" tree-item-more "</span>:<span class="literal">""</span>);content.push(<span class="literal">"'"</span>);<span class="reserved">this</span>.labelContainerId=<span class="literal">"zpTree"</span>+<span class="reserved">this</span>.config.tree.id+<span class="literal">"Node"</span>+<span class="reserved">this</span>.id+<span class="literal">"LabelContainer"</span>;content.push(<span class="literal">" id='"</span>);content.push(<span class="reserved">this</span>.labelContainerId);content.push(<span class="literal">"'&gt;"</span>);content.push(<span class="literal">"&lt;table class='tree-table' cellpadding='0' cellspacing='0'&gt;&lt;tbody&gt;&lt;tr&gt;"</span>);<span class="reserved">if</span>(<span class="reserved">this</span>.hasSubtree()){content.push(<span class="literal">"&lt;td id='"</span>);content.push(<span class="literal">"zpTree"</span>);content.push(<span class="reserved">this</span>.config.tree.id);content.push(<span class="literal">"Node"</span>);content.push(<span class="reserved">this</span>.id);content.push(<span class="literal">"SignElement"</span>);content.push(<span class="literal">"'"</span>);content.push(<span class="literal">" onclick='Zapatec.Widget.callMethod("</span>);content.push(<span class="reserved">this</span>.id);content.push(<span class="literal">", \"</span>onSignClick\<span class="literal">")'"</span>);content.push(<span class="literal">" ondblclick='Zapatec.Widget.callMethod("</span>);content.push(<span class="reserved">this</span>.id);content.push(<span class="literal">", \"</span>onSignDblclick\<span class="literal">")'"</span>);content.push(<span class="literal">" class='tgb "</span>);content.push(<span class="reserved">this</span>.data.isExpanded?<span class="literal">"minus"</span>:<span class="literal">"plus"</span>);content.push(<span class="literal">"'&gt;"</span>);content.push(<span class="literal">"&lt;img src='"</span>);content.push(Zapatec.zapatecPath);content.push(<span class="literal">"zpempty.gif' class='tgb' alt=''/&gt;"</span>);content.push(<span class="literal">"&lt;/td&gt;"</span>);}
<span class="reserved">if</span>(<span class="reserved">this</span>.config.tree.config.defaultIcons||(<span class="reserved">this</span>.hasSubtree()&amp;&amp;(<span class="reserved">this</span>.data.collapsedIcon||<span class="reserved">this</span>.data.expandedIcon||<span class="reserved">this</span>.data.fetchingIcon)||!<span class="reserved">this</span>.hasSubtree()&amp;&amp;<span class="reserved">this</span>.data.elementIcon)){content.push(<span class="literal">"&lt;td"</span>);content.push(<span class="literal">" id='zpTree"</span>);content.push(<span class="reserved">this</span>.config.tree.id);content.push(<span class="literal">"Node"</span>);content.push(<span class="reserved">this</span>.id);content.push(<span class="literal">"IconElement'"</span>);content.push(<span class="literal">" onclick='Zapatec.Widget.callMethod("</span>);content.push(<span class="reserved">this</span>.id);content.push(<span class="literal">", \"</span>onIconClick\<span class="literal">")'"</span>);content.push(<span class="literal">" ondblclick='Zapatec.Widget.callMethod("</span>);content.push(<span class="reserved">this</span>.id);content.push(<span class="literal">", \"</span>onIconDblclick\<span class="literal">")'"</span>);content.push(<span class="literal">" oncontextmenu='return Zapatec.Widget.callMethod("</span>);content.push(<span class="reserved">this</span>.id);content.push(<span class="literal">", \"</span>onIconContextMenu\<span class="literal">", event)'"</span>);content.push(<span class="literal">" onmouseup='return Zapatec.Widget.callMethod("</span>);content.push(<span class="reserved">this</span>.id);content.push(<span class="literal">", \"</span>onIconMouseup\<span class="literal">", event)'"</span>);content.push(<span class="literal">" class='icon "</span>);<span class="reserved">if</span>(<span class="reserved">this</span>.config.tree.config.defaultIcons){content.push(<span class="reserved">this</span>.config.tree.config.defaultIcons);}
content.push(<span class="literal">"'&gt;"</span>);<span class="reserved">if</span>(<span class="reserved">this</span>.data.collapsedIcon||<span class="reserved">this</span>.data.expandedIcon||<span class="reserved">this</span>.data.fetchingIcon||<span class="reserved">this</span>.data.elementIcon){<span class="reserved">if</span>(<span class="reserved">this</span>.hasSubtree()){<span class="reserved">if</span>(<span class="reserved">this</span>.data.expandedIcon){content.push(<span class="reserved">this</span>.data.expandedIcon);}
<span class="reserved">if</span>(<span class="reserved">this</span>.data.collapsedIcon){content.push(<span class="reserved">this</span>.data.collapsedIcon);}
<span class="reserved">if</span>(<span class="reserved">this</span>.data.fetchingIcon){content.push(<span class="reserved">this</span>.data.fetchingIcon);}}<span class="reserved">else</span>{content.push(<span class="reserved">this</span>.data.elementIcon);}}<span class="reserved">else</span>{content.push(<span class="literal">"&lt;img src='"</span>);content.push(Zapatec.zapatecPath);content.push(<span class="literal">"zpempty.gif' class='icon' alt=''/&gt;"</span>);}
content.push(<span class="literal">"&lt;/td&gt;"</span>);}
<span class="reserved">if</span>(<span class="reserved">this</span>.config.tree.config.putCheckboxes){content.push(<span class="literal">"&lt;td"</span>);content.push(<span class="literal">" id='zpTree"</span>);content.push(<span class="reserved">this</span>.config.tree.id);content.push(<span class="literal">"Node"</span>);content.push(<span class="reserved">this</span>.id);content.push(<span class="literal">"CheckboxElement'"</span>);content.push(<span class="literal">" onclick='Zapatec.Widget.callMethod("</span>);content.push(<span class="reserved">this</span>.id);content.push(<span class="literal">", \"</span>checkboxChanged\<span class="literal">")'"</span>);content.push(<span class="literal">" class='checkboxContainer "</span>);content.push(<span class="reserved">this</span>.data.isChecked?<span class="literal">"checkboxChecked"</span>:<span class="literal">"checkboxUnchecked"</span>)
content.push(<span class="literal">"'&gt;"</span>);content.push(<span class="literal">"&lt;img src='"</span>);content.push(Zapatec.zapatecPath);content.push(<span class="literal">"zpempty.gif' class='checkboxContainer' alt=''/&gt;"</span>);content.push(<span class="literal">"&lt;/td&gt;"</span>);}
var attributes=Zapatec.Utils.clone(<span class="reserved">this</span>.data.attributes);<span class="reserved">if</span>(!attributes){attributes={<span class="literal">"id"</span>:<span class="literal">"zpTree"</span>+<span class="reserved">this</span>.config.tree.id+<span class="literal">"Node"</span>+<span class="reserved">this</span>.id+<span class="literal">"LabelElement"</span>,<span class="literal">"onclick"</span>:<span class="literal">"Zapatec.Widget.callMethod("</span>+<span class="reserved">this</span>.id+<span class="literal">", \"</span>onLabelClick\<span class="literal">")"</span>,<span class="literal">"ondblclick"</span>:<span class="literal">"Zapatec.Widget.callMethod("</span>+<span class="reserved">this</span>.id+<span class="literal">", \"</span>onLabelDblclick\<span class="literal">")"</span>,<span class="literal">"oncontextmenu"</span>:<span class="literal">"return Zapatec.Widget.callMethod("</span>+<span class="reserved">this</span>.id+<span class="literal">", \"</span>onLabelContextMenu\<span class="literal">", event)"</span>,<span class="literal">"onmouseup"</span>:<span class="literal">"Zapatec.Widget.callMethod("</span>+<span class="reserved">this</span>.id+<span class="literal">", \"</span>onLabelMouseup\<span class="literal">", event)"</span>,<span class="literal">"class"</span>:<span class="literal">"label "</span>+(<span class="reserved">this</span>.data.children?<span class="literal">"menutitle"</span>:<span class="literal">"submenu"</span>)};}<span class="reserved">else</span>{<span class="reserved">if</span>(attributes.id==null){attributes.id=<span class="literal">"zpTree"</span>+<span class="reserved">this</span>.config.tree.id+<span class="literal">"Node"</span>+<span class="reserved">this</span>.id+<span class="literal">"LabelElement"</span>;}
<span class="reserved">if</span>(attributes[<span class="literal">'class'</span>]!=null){attributes[<span class="literal">'class'</span>]+=<span class="literal">" label "</span>+(<span class="reserved">this</span>.data.children?<span class="literal">"menutitle"</span>:<span class="literal">"submenu"</span>);}<span class="reserved">else</span>{attributes[<span class="literal">'class'</span>]=<span class="literal">"label "</span>+(<span class="reserved">this</span>.data.children?<span class="literal">"menutitle"</span>:<span class="literal">"submenu"</span>);}
<span class="reserved">if</span>(attributes.onclick!=null){attributes.onclick=<span class="literal">"Zapatec.Widget.callMethod("</span>+<span class="reserved">this</span>.id+<span class="literal">", \"</span>onLabelClick\<span class="literal">");"</span>+<span class="reserved">this</span>.data.attributes.onclick;}<span class="reserved">else</span>{attributes.onclick=<span class="literal">"Zapatec.Widget.callMethod("</span>+<span class="reserved">this</span>.id+<span class="literal">", \"</span>onLabelClick\<span class="literal">");"</span>;}
<span class="reserved">if</span>(attributes.ondblclick!=null){attributes.ondblclick=<span class="literal">"Zapatec.Widget.callMethod("</span>+<span class="reserved">this</span>.id+<span class="literal">", \"</span>onLabelDblclick\<span class="literal">");"</span>+<span class="reserved">this</span>.data.attributes.ondblclick;}<span class="reserved">else</span>{attributes.ondblclick=<span class="literal">"Zapatec.Widget.callMethod("</span>+<span class="reserved">this</span>.id+<span class="literal">", \"</span>onLabelDblclick\<span class="literal">");"</span>;}
<span class="reserved">if</span>(attributes.oncontextmenu!=null){attributes.oncontextmenu=<span class="literal">"return Zapatec.Widget.callMethod("</span>+<span class="reserved">this</span>.id+<span class="literal">", \"</span>onLabelContextMenu\<span class="literal">", event);"</span>+<span class="reserved">this</span>.data.attributes.oncontextmenu;}<span class="reserved">else</span>{attributes.oncontextmenu=<span class="literal">"return Zapatec.Widget.callMethod("</span>+<span class="reserved">this</span>.id+<span class="literal">", \"</span>onLabelContextMenu\<span class="literal">", event);"</span>;}
<span class="reserved">if</span>(attributes.onmouseup!=null){attributes.onmouseup=<span class="literal">"Zapatec.Widget.callMethod("</span>+<span class="reserved">this</span>.id+<span class="literal">", \"</span>onLabelMouseup\<span class="literal">", event);"</span>+<span class="reserved">this</span>.data.attributes.onmouseup;}<span class="reserved">else</span>{attributes.onmouseup=<span class="literal">"Zapatec.Widget.callMethod("</span>+<span class="reserved">this</span>.id+<span class="literal">", \"</span>onLabelMouseup\<span class="literal">", event);"</span>;}}
content.push(<span class="literal">"&lt;td"</span>);<span class="reserved">if</span>(Zapatec.is_ie){content.push(<span class="literal">" unselectable='on'"</span>);}
<span class="reserved">for</span>(var attrName in attributes){var tmp=attributes[attrName];<span class="reserved">if</span>(typeof(tmp)!=<span class="literal">'string'</span>){tmp+=<span class="literal">""</span>;}
<span class="reserved">if</span>(tmp){var attrVal=tmp.replace(/<span class="literal">'/g,"\\'</span><span class="literal">");content.push("</span> <span class="literal">"+attrName+"</span>=<span class="literal">'"+attrVal+"'</span><span class="literal">");}}
content.push("</span>&gt;<span class="literal">");if(this.config.tree.config.prevCompatible){content.push("</span>&lt;span class=<span class="literal">'label'</span>&gt;<span class="literal">");}
if(this.data.label){content.push(this.data.label);}
if(this.config.tree.config.prevCompatible){content.push("</span>&lt;/span&gt;<span class="literal">");}
content.push("</span>&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;/div&gt;<span class="literal">");if(this.data.isSelected){this.select();}
if(this.hasSubtree()){content.push("</span>&lt;div class=<span class="literal">'tree'</span> id=<span class="literal">'");content.push("zpTree");content.push(this.config.tree.id);content.push("Node");content.push(this.id);content.push("ChildrenContainer");content.push("'</span><span class="literal">");content.push("</span>&gt;&lt;/div&gt;<span class="literal">");}
this.fireEvent("</span>afterCreate<span class="literal">");return content.join("</span><span class="literal">");};Zapatec.Tree.Node.prototype.hasSubtree=function(){return this.data.children!=null;};Zapatec.Tree.Node.prototype.afterCreate=function(){if(this.isCreated){return false;}
this.labelContainer=document.getElementById(this.labelContainerId);if(this.data.collapsedIcon||this.data.expandedIcon||this.data.fetchingIcon||this.data.elementIcon){this.iconElement=this.labelContainer.childNodes[0].childNodes[0].childNodes[0].childNodes[1];}
if(this.hasSubtree()){this.signElement=this.iconElement?this.iconElement.previousSibling:this.labelContainer.childNodes[0].childNodes[0].childNodes[0].childNodes[0];this.childrenContainer=this.labelContainer.nextSibling;}
if(this.config.tree.config.putBackReferences&amp;&amp;this.getLinkToLabelElement()){Zapatec.Utils.createProperty(this.labelElement,"</span>zpTreeNode<span class="literal">",this);}
if(this.data.collapsedIcon||this.data.expandedIcon||this.data.fetchingIcon||this.data.elementIcon){if(this.iconElement&amp;&amp;this.iconElement.childNodes.length!=0){var tmp=[this.iconElement.childNodes[0],this.iconElement.childNodes[1],this.iconElement.childNodes[2]];if(this.hasSubtree()){for(var ii=0;ii&lt;2;ii++){var tmpIcon=tmp[ii];if(!tmpIcon){continue;}
if(tmpIcon.className.indexOf("</span>collapsedIcon<span class="literal">")&gt;=0){this.collapsedIcon=tmpIcon;}else if(tmpIcon.className.indexOf("</span>expandedIcon<span class="literal">")&gt;=0){this.expandedIcon=tmpIcon;}else if(tmpIcon.className.indexOf("</span>fetchingIcon<span class="literal">")&gt;=0){this.fetchingIcon=tmpIcon;}}}else{this.elementIcon=tmp[0];}
this.putIcons();}}
this.isCreated=true;this.putLines();if(this.data.isExpanded||this.config.tree.expandToLevelNum&gt;this.config.level){this.expand();}else{this.collapse();}
if(this.config.tree.config.putCheckboxes){var tmp=this.labelContainer.childNodes[0].childNodes[0].childNodes[0];this.checkboxContainer=tmp.childNodes[tmp.childNodes.length-2];}
if(this.data.isSelected){this.select();}
if(this.config.tree.config.createWholeDOM){this.createChildren();}};Zapatec.Tree.Node.prototype.getLinkToLabelElement=function(){if(this.config.isRootNode){return null;}
if(this.labelElement){return this.labelElement;}
this.labelElement=this.labelContainer.childNodes[0].childNodes[0].childNodes[0].lastChild;return this.labelElement;};Zapatec.Tree.Node.prototype.createChildren=function(){if(!this.hasSubtree()||this.hasSubtree()&amp;&amp;this.isChildrenCreated==true){return null;}
if(this.config.tree.config.quick||this.config.isRootNode){this.initChildren();}
var content=[];for(var ii=0;ii&lt;this.children.length;ii++){content.push(this.children[ii].create());}
Zapatec.Transport.setInnerHtml({html:content.join("</span><span class="literal">"),container:this.childrenContainer});this.isChildrenCreated=true;if(this.config.tree.config.createWholeDOM){for(var ii=0;ii&lt;this.children.length;ii++){this.children[ii].afterCreate();}}};Zapatec.Tree.Node.prototype.initChildren=function(){if(!this.data.children){return null;}
for(var ii=0;ii&lt;this.data.children.length;ii++){this.children.push(new Zapatec.Tree.Node({tree:this.config.tree,parentNode:this,level:this.config.level+1,source:this.data.children[ii],sourceType:"</span>json<span class="literal">",eventListeners:this.config.eventListeners}));}};Zapatec.Tree.Node.prototype.isFirstNodeInBranch=function(){return this.config.isRootNode||this.labelContainer.parentNode.firstChild==this.labelContainer;};Zapatec.Tree.Node.prototype.isLastNodeInBranch=function(){return this.config.isRootNode||this.labelContainer.parentNode.lastChild==this.labelContainer||this.labelContainer.parentNode.lastChild==this.childrenContainer;};Zapatec.Tree.Node.prototype.checkboxChanged=function(value){if(typeof(value)=='undefined'){value=!this.data.isChecked;}
this.data.isChecked=value;if(this.isCreated){this.checkboxContainer.className="</span>checkboxContainer <span class="literal">"+
(this.data.isChecked?"</span>checkboxChecked<span class="literal">":"</span>checkboxUnchecked<span class="literal">");}
if(this.hasSubtree()&amp;&amp;this.config.tree.config.dependantCheckboxes){var toCheck=this.data.isChecked;for(var ii=0;ii&lt;this.children.length;ii++){this.children[ii].checkboxChanged(toCheck);}}
if(this.config.parentNode&amp;&amp;!this.config.parentNode.config.isRootNode){this.config.parentNode.updateCheckbox();}};Zapatec.Tree.Node.prototype.updateCheckbox=function(){if(this.config.isRootNode){return;}
if(!this.config.tree.config.dependantCheckboxes){return;}
var stats=this.getChildrenStats();if(stats.hasChecked&amp;&amp;!stats.hasUnchecked){this.data.isChecked=true;if(this.isCreated){this.checkboxContainer.className="</span>checkboxContainer checkboxChecked<span class="literal">";}}else if(stats.hasChecked&amp;&amp;stats.hasUnchecked){this.data.isChecked=null;if(this.isCreated){this.checkboxContainer.className="</span>checkboxContainer checkboxHalfChecked<span class="literal">";}}else if(!stats.hasChecked&amp;&amp;stats.hasUnchecked){this.data.isChecked=false;if(this.isCreated){this.checkboxContainer.className="</span>checkboxContainer checkboxUnchecked<span class="literal">";}}
if(this.config.parentNode&amp;&amp;!this.config.parentNode.config.isRootNode){this.config.parentNode.updateCheckbox();}};Zapatec.Tree.Node.prototype.getChildrenStats=function(){var res={hasChecked:false,hasUnchecked:false}
if(this.hasSubtree()&amp;&amp;this.data.children.length&gt;0){for(var ii=0;ii&lt;this.children.length;ii++){var stats=this.children[ii].getChildrenStats();res.hasChecked=res.hasChecked||stats.hasChecked;res.hasUnchecked=res.hasUnchecked||stats.hasUnchecked;if(res.hasChecked&amp;&amp;res.hasUnchecked){break;}}}else{res.hasChecked=this.data.isChecked;res.hasUnchecked=!this.data.isChecked;}
return res;}
Zapatec.Tree.Node.prototype.putLines=function(){if(this.config.isRootNode){return null;}
this.labelContainer.className=this.labelContainer.className.replace(/tree-lines-./,"</span><span class="literal">");if(this.isFirstNodeInBranch()){if(this.isLastNodeInBranch()){if(this.config.level==1){this.labelContainer.className+="</span> tree-lines-s<span class="literal">";}else{this.labelContainer.className+="</span> tree-lines-b<span class="literal">";}}else{if(this.config.level==1){this.labelContainer.className+="</span> tree-lines-t<span class="literal">";}else{this.labelContainer.className+="</span> tree-lines-c<span class="literal">";}}}else if(this.isLastNodeInBranch()){this.labelContainer.className+="</span> tree-lines-b<span class="literal">";}else{this.labelContainer.className+="</span> tree-lines-c<span class="literal">";}
if(this.hasSubtree()){if(this.isLastNodeInBranch()){this.childrenContainer.className=this.childrenContainer.className.replace(/\btree-lined\b/,"</span><span class="literal">");}else{this.childrenContainer.className+="</span> tree-lined<span class="literal">";}}};Zapatec.Tree.Node.prototype.putIcons=function(){if(!this.isCreated){return null;}
if(this.expandedIcon||this.collapsedIcon||this.fetchingIcon||this.elementIcon){if(this.fetchingIcon){this.fetchingIcon.style.display=this.isFetching?"</span>block<span class="literal">":"</span>none<span class="literal">";}
if(this.expandedIcon){this.expandedIcon.style.display=!this.data.isExpanded||this.isFetching?"</span>none<span class="literal">":"</span>block<span class="literal">";}
if(this.collapsedIcon){this.collapsedIcon.style.display=this.data.isExpanded||this.isFetching?"</span>none<span class="literal">":"</span>block<span class="literal">";}}
if(this.signElement){if(this.isFetching){this.signElement.className=this.signElement.className.replace(/\b(plus|minus)\b/,"</span>fetching<span class="literal">");}else if(this.data.isExpanded){this.signElement.className=this.signElement.className.replace(/\b(plus|fetching)\b/,"</span>minus<span class="literal">");}else{this.signElement.className=this.signElement.className.replace(/\b(minus|fetching)\b/,"</span>plus<span class="literal">");}}};Zapatec.Tree.Node.prototype.onIconClick=function(){this.fireEvent("</span>iconClick<span class="literal">");if(this.config.tree.config.selectOnIconClick){if(this.config.tree.config.deselectSelected&amp;&amp;this.data.isSelected){this.deselect();}else{this.select();}}
if(!this.config.tree.config.expandOnIconClick){return null;}
this.toggle();};Zapatec.Tree.Node.prototype.onIconDblclick=function(){this.fireEvent("</span>iconDblclick<span class="literal">");if(this.config.tree.config.selectOnIconDblclick){if(this.config.tree.config.deselectSelected&amp;&amp;this.data.isSelected){this.deselect();}else{this.select();}}
if(!this.config.tree.config.expandOnIconDblclick){return null;}
this.toggle();};Zapatec.Tree.Node.prototype.onIconContextMenu=function(){return!this.config.tree.config.disableContextMenu;}
Zapatec.Tree.Node.prototype.onIconMouseup=function(ev){if(!ev){ev=window.event;}
if(Zapatec.Tree.Utils.isRightClick(ev)){this.fireEvent("</span>labelRightClick<span class="literal">",ev);Zapatec.Utils.stopEvent(ev);ev.returnValue=true;return false;}}
Zapatec.Tree.Node.prototype.onSignClick=function(){this.fireEvent("</span>signClick<span class="literal">");if(this.config.tree.config.selectOnSignClick){if(this.config.tree.config.deselectSelected&amp;&amp;this.data.isSelected){this.deselect();}else{this.select();}}
if(!this.config.tree.config.expandOnSignClick){return null;}
this.toggle();};Zapatec.Tree.Node.prototype.onSignDblclick=function(){this.fireEvent("</span>signDblclick<span class="literal">");if(this.config.tree.config.selectOnSignDblclick){if(this.config.tree.config.deselectSelected&amp;&amp;this.data.isSelected){this.deselect();}else{this.select();}}
if(!this.config.tree.config.expandOnSignDblclick){return null;}
this.toggle();};Zapatec.Tree.Node.prototype.onLabelClick=function(){this.fireEvent("</span>labelClick<span class="literal">");if(this.config.tree.config.selectOnLabelClick){if(this.config.tree.config.deselectSelected&amp;&amp;this.data.isSelected){this.deselect();}else{this.select();}}
if(this.config.tree.config.editable&amp;&amp;this.config.tree.config.editOnClick){this.config.tree.editInline.show(this.getLinkToLabelElement());}
if(!this.config.tree.config.expandOnLabelClick){return null;}
this.toggle();};Zapatec.Tree.Node.prototype.onLabelDblclick=function(){this.fireEvent("</span>labelDblclick<span class="literal">");if(this.config.tree.config.selectOnLabelDblclick){if(this.config.tree.config.deselectSelected&amp;&amp;this.data.isSelected){this.deselect();}else{this.select();}}
if(this.config.tree.config.editable&amp;&amp;this.config.tree.config.editOnDblclick){this.config.tree.editInline.show(this.getLinkToLabelElement());}
if(!this.config.tree.config.expandOnLabelDblclick){return null;}
this.toggle();};Zapatec.Tree.Node.prototype.onLabelContextMenu=function(){return!this.config.tree.config.disableContextMenu;}
Zapatec.Tree.Node.prototype.onLabelMouseup=function(ev){if(!ev){ev=window.event;}
if(Zapatec.Tree.Utils.isRightClick(ev)){this.fireEvent("</span>labelRightClick<span class="literal">",ev);Zapatec.Utils.stopEvent(ev);ev.returnValue=true;return false;}}
Zapatec.Tree.Node.prototype.select=function(){if(this.config.isRootNode){return null;}
if(!this.config.tree.config.selectMultiple){if(this.config.tree.prevSelected){this.config.tree.prevSelected.deselect();}}
this.data.isSelected=true;this.config.tree.prevSelected=this;if(this.config.tree.config.saveState){Zapatec.Utils.writeCookie("</span>Zapatec.Tree-<span class="literal">"+this.config.tree.config.saveId,this.data.attributes&amp;&amp;this.data.attributes.id?this.data.attributes.id:this.id,null,'/',7);}
if(this.isCreated&amp;&amp;this.config.tree.config.highlightSelectedNode){Zapatec.Utils.addClass(this.labelContainer,"</span>tree-item-selected<span class="literal">");}
this.fireEvent("</span>select<span class="literal">");if(this.config.tree.onItemSelect){this.config.tree.onItemSelect(this.data&amp;&amp;this.data.attributes&amp;&amp;this.data.attributes.id?this.data.attributes.id:this.id);}};Zapatec.Tree.Node.prototype.deselect=function(){if(this.config.isRootNode||!this.data.isSelected){return null;}
if(this.isCreated){this.labelContainer.className=this.labelContainer.className.replace(/\btree-item-selected\b/,"</span><span class="literal">");}
this.data.isSelected=false;this.config.tree.prevSelected=null;this.fireEvent("</span>deselect<span class="literal">");};Zapatec.Tree.Node.prototype.collapse=function(){this.data.isExpanded=false;if(!this.isCreated||!this.hasSubtree()){return null;}
this.childrenContainer.style.display='none';if(!this.config.isRootNode){this.labelContainer.className=this.labelContainer.className.replace(/\btree-item-expanded\b/,"</span><span class="literal">");this.labelContainer.className+="</span> tree-item-collapsed<span class="literal">";this.putIcons();}
this.fireEvent("</span>collapse<span class="literal">");};Zapatec.Tree.Node.prototype.collapseBranch=function(){if(!this.children){return null;}
for(var ii=0;ii&lt;this.children.length;ii++){this.children[ii].collapseBranch();}
this.collapse();this.fireEvent("</span>collapseBranch<span class="literal">");};Zapatec.Tree.Node.prototype.expand=function(){this.data.isExpanded=true;if(this.config.tree.config.compact){var parentNodes=[];var parentNode=this;while(parentNode!=null&amp;&amp;!parentNode.config.isRootNode){parentNodes.push(parentNode);parentNode=parentNode.config.parentNode;}
for(var ii=this.config.tree.allNodes.length-1;ii&gt;=0;ii--){var node=this.config.tree.allNodes[ii];if(node.data&amp;&amp;node.data.isExpanded){var isParent=false;for(var jj=parentNodes.length-1;jj&gt;=0;jj--){if(node==parentNodes[jj]){isParent=true;break;}}
if(!isParent){node.collapse();}}}}
if(!this.isCreated||!this.hasSubtree()){return null;}
if(!this.config.isRootNode){this.labelContainer.className=this.labelContainer.className.replace(/\btree-item-collapsed\b/,"</span><span class="literal">");this.labelContainer.className+="</span> tree-item-expanded<span class="literal">";this.putIcons();}
if(this.config.quick||this.children.length==0){if(this.config.source){if(!this.isFetching){this.loadData();}}else{this.childrenContainer.style.display='block';this.createChildren();for(var ii=0;ii&lt;this.children.length;ii++){if(!this.children[ii].isCreated){this.children[ii].afterCreate();}}}}else{this.childrenContainer.style.display='block';this.createChildren();for(var ii=0;ii&lt;this.children.length;ii++){if(!this.children[ii].isCreated){this.children[ii].afterCreate();}}
if(this.config.source){if(!this.isFetching){this.loadData();}}}
this.fireEvent("</span>expand<span class="literal">");};Zapatec.Tree.Node.prototype.expandBranch=function(){if(!this.children){return null;}
for(var ii=0;ii&lt;this.children.length;ii++){this.children[ii].expandBranch();}
this.expand();this.fireEvent("</span>expandBranch<span class="literal">");};Zapatec.Tree.Node.prototype.toggle=function(){this.fireEvent("</span>toggle<span class="literal">");if(this.data.isExpanded){return this.collapse();}else{return this.expand();}};Zapatec.Tree.Node.prototype.loadDataJson=function(objResponse){if(objResponse==null){return null;}
if(objResponse.expandedIcon){objResponse.expandedIcon=Zapatec.Tree.Utils.addIconClass(objResponse.expandedIcon,"</span>expandedIcon<span class="literal">");}
if(objResponse.collapsedIcon){objResponse.collapsedIcon=Zapatec.Tree.Utils.addIconClass(objResponse.collapsedIcon,"</span>collapsedIcon<span class="literal">");}
if(objResponse.fetchingIcon){objResponse.fetchingIcon=Zapatec.Tree.Utils.addIconClass(objResponse.fetchingIcon,"</span>fetchingIcon<span class="literal">");}
if(objResponse.elementIcon){objResponse.elementIcon=Zapatec.Tree.Utils.addIconClass(objResponse.elementIcon,"</span>elementIcon<span class="literal">");}
if(this.isCreated&amp;&amp;(!this.config.tree.config.quick||this.config.tree.config.quick&amp;&amp;this.isChildrenCreated)){if(objResponse.children){for(var ii=0;ii&lt;objResponse.children.length;ii++){this.appendChild(objResponse.children[ii]);}}}else{if(this.data==null){this.data=objResponse;}else{if(objResponse.children){this.data.children=this.data.children.concat(objResponse.children);}else{this.data.children=objResponse.children;}
this.updateCheckbox();}
if(!this.config.tree.config.quick||this.config.isRootNode){this.initChildren();}
if(this.data.attributes&amp;&amp;this.data.attributes.id){this.config.tree.id2Obj[this.data.attributes.id]=this;}else{this.config.tree.id2Obj[this.id]=this;}}};Zapatec.Tree.Node.prototype.loadDataXml=function(objSource){if(objSource==null||objSource.documentElement==null){return null;}
if(objSource.documentElement.tagName.toLowerCase()=="</span>list<span class="literal">"){var arr=[];for(var jj=0;jj&lt;objSource.documentElement.childNodes.length;jj++){try{var tmp=Zapatec.Tree.Utils.convertXml2Json(objSource.documentElement.childNodes[jj]);}catch(e){}
if(tmp!=null){arr.push(tmp);}}
this.loadDataJson({children:arr});}else{this.loadDataJson(Zapatec.Tree.Utils.convertXml2Json(objSource.documentElement));}};Zapatec.Tree.Node.prototype.loadDataHtml=function(objSource){if(objSource==null||!objSource.nodeName){return null;}
if(objSource.nodeName.toLowerCase()=='ul'){var arr=[];for(var ii=0;ii&lt;objSource.childNodes.length;ii++){var tmp=Zapatec.Tree.Utils.convertLi2Json(objSource.childNodes[ii],this.config.tree.config.prevCompatible);if(tmp!=null){arr.push(tmp);}}
this.loadDataJson({children:arr});}else{this.loadDataJson(Zapatec.Tree.Utils.convertLi2Json(objSource,this.config.tree.config.prevCompatible));}};Zapatec.Tree.Node.prototype.showContainer=function(){};Zapatec.Tree.Node.prototype.hideContainer=function(){};Zapatec.Tree.Node.prototype.expandHere=function(){if(this.config.isRootNode){return null;}
var parentNodes=[];var parentNode=this.config.parentNode;while(parentNode!=null){parentNodes.push(parentNode);parentNode=parentNode.config.parentNode;}
for(var ii=parentNodes.length-1;ii&gt;=0;ii--){parentNodes[ii].expand();}};Zapatec.Tree.Node.prototype.sync=function(){if(this.config.isRootNode){return null;}
this.expandHere();this.select();};Zapatec.Tree.Node.prototype.destroy=function(quick){if(this.isCreated&amp;&amp;!quick){Zapatec.Utils.destroy(this.labelContainer);if(this.hasSubtree()){Zapatec.Utils.destroy(this.childrenContainer);}}
if(this.children){for(var ii=this.children.length-1;ii&gt;=0;ii--){this.children[ii].destroy(true);}}
if(this.config.isRootNode){return;}
var childIndex=null;var childrenArray=this.config.parentNode.children;for(var ii=0;ii&lt;childrenArray.length;ii++){if(childrenArray[ii]==this){childIndex=ii;break;}}
if(childIndex==null){}else{if(childIndex!=0&amp;&amp;childrenArray[childIndex-1].isCreated){childrenArray[childIndex-1].putLines();}
if(childIndex!=childrenArray.length-1&amp;&amp;childrenArray[childIndex+1].isCreated){childrenArray[childIndex+1].putLines();}
childrenArray=childrenArray.slice(0,childIndex).concat(childrenArray.slice(childIndex+1));this.config.parentNode.children=childrenArray;}
for(var ii=0;ii&lt;this.config.tree.allNodes.length;ii++){if(this.config.tree.allNodes[ii]==this){childIndex=ii;break;}}
if(childIndex==null){}else{this.config.tree.allNodes=this.config.tree.allNodes.slice(0,childIndex).concat(this.config.tree.allNodes.slice(childIndex+1));}
if(this.data.attributes&amp;&amp;this.data.attributes.id){this.config.tree.id2Obj[this.data.attributes.id]=null;}else{this.config.tree.id2Obj[this.id]=null;}
if(this.config.tree.prevSelected==this){this.config.tree.prevSelected=null;}
if(this.config.parentNode){this.config.parentNode.updateCheckbox();}};Zapatec.Tree.Node.prototype.addNode=function(newChild,insertPosition){if(newChild!=null&amp;&amp;newChild.nodeType&amp;&amp;newChild.nodeType==1&amp;&amp;newChild.nodeName.toLowerCase()=="</span>li<span class="literal">"){newChild=Zapatec.Tree.Utils.convertLi2Json(newChild,this.config.tree.config.prevCompatible);}
if(newChild==null){Zapatec.Log({description:"</span>No data given!<span class="literal">"});return null;}
var resultNode=newChild;this.data.children.splice(insertPosition,0,newChild);if(this.isCreated||!this.config.tree.quick){resultNode=new Zapatec.Tree.Node({tree:this.config.tree,parentNode:this,level:this.config.level+1,source:newChild,sourceType:"</span>json<span class="literal">",eventListeners:this.config.eventListeners});if(this.isChildrenCreated){var prevNode=null;var nextNode=null;var insertBeforeElement=null;if(insertPosition!=0){prevNode=this.children[insertPosition-1];}
if(insertPosition!=this.children.length){nextNode=this.children[insertPosition];insertBeforeElement=nextNode.labelContainer;}
var tmp=document.createElement("</span>SPAN<span class="literal">");Zapatec.Transport.setInnerHtml({html:resultNode.create(),container:tmp});var nodes=[];for(var ii=0;ii&lt;tmp.childNodes.length;ii++){nodes.push(tmp.childNodes[ii]);}
if(insertBeforeElement){for(var ii=0;ii&lt;nodes.length;ii++){this.childrenContainer.insertBefore(nodes[ii],insertBeforeElement);}}else{for(var ii=0;ii&lt;nodes.length;ii++){this.childrenContainer.appendChild(nodes[ii]);}}
resultNode.afterCreate();if(prevNode){prevNode.putLines();}
if(nextNode){nextNode.putLines();}}
this.children.splice(insertPosition,0,resultNode);}
this.updateCheckbox();if(this.config.parentNode){this.config.parentNode.updateCheckbox();}
return resultNode;};Zapatec.Tree.Node.prototype.appendChild=function(newChild,atStart){if(atStart){return this.addNode(newChild,0);}else{return this.addNode(newChild,this.children.length);}};Zapatec.Tree.Node.prototype.insertBefore=function(newChild){for(var ii=this.config.parentNode.children.length-1;ii&gt;=0;ii--){if(this==this.config.parentNode.children[ii]){return this.config.parentNode.addNode(newChild,ii);}}};Zapatec.Tree.Node.prototype.insertAfter=function(newChild){for(var ii=this.config.parentNode.children.length-1;ii&gt;=0;ii--){if(this==this.config.parentNode.children[ii]){return this.config.parentNode.addNode(newChild,ii+1);}}};Zapatec.Tree.Node.prototype.getState=function(){var result={label:this.data.label,isSelected:this.data.isSelected,attributes:Zapatec.Utils.clone(this.data.attributes),isChecked:this.data.isChecked};if(this.isCreated&amp;&amp;!this.config.isRootNode){result.label=this.getLinkToLabelElement().innerHTML;}
if(this.hasSubtree()){result.isExpanded=this.data.isExpanded;result.source=this.config.source;result.sourceType=this.config.sourceType;result.expandedIcon=this.data.expandedIcon;result.collapsedIcon=this.data.collapsedIcon;result.fetchingIcon=this.data.fetchingIcon;result.children=[];for(var ii=0;ii&lt;this.children.length;ii++){result.children.push(this.children[ii].getState());}}else{result.elementIcon=this.data.elementIcon;}
return result;};Zapatec.Tree.Node.prototype.rename=function(newLabel){this.fireEvent("</span>rename<span class="literal">",this.data.label,newLabel);this.data.label=newLabel;var labelElement=this.getLinkToLabelElement();Zapatec.Transport.setInnerHtml({html:newLabel,container:labelElement});};Zapatec.Tree.Utils={};Zapatec.Tree.Utils.convertLi2Json=function(liNode,compat){if(liNode==null||liNode.nodeType!=1||liNode.nodeName.toLowerCase()!='li'){return null;}
var struct={attributes:{}};var ul=null;var expandedIcon=null;var collapsedIcon=null;var fetchingIcon=null;var icon=null;var labelEl=document.createElement("</span>span<span class="literal">");var cNodes=[];for(var ii=0;ii&lt;liNode.childNodes.length;ii++){cNodes.push(liNode.childNodes[ii]);}
for(var ii=0;ii&lt;cNodes.length;ii++){var node=cNodes[ii];if(node.nodeType==1){if(node.nodeName.toLowerCase()=='img'){if(compat){if(icon==null){icon=node;}
if(expandedIcon==null){expandedIcon=node;Zapatec.Utils.addClass(expandedIcon,"</span>expandedIcon<span class="literal">");continue;}else if(collapsedIcon==null){collapsedIcon=node;Zapatec.Utils.addClass(collapsedIcon,"</span>collapsedIcon<span class="literal">");continue;}
if(icon==node){continue;}}else{if(/\belementIcon\b/.test(node.className)){icon=node;continue;}else if(/\bexpandedIcon\b/.test(node.className)){expandedIcon=node;continue;}else if(/\bcollapsedIcon\b/.test(node.className)){collapsedIcon=node;continue;}else if(/\bfetchingIcon\b/.test(node.className)){fetchingIcon=node;continue;}}}
if(node.nodeName.toLowerCase()=='ul'){ul=node;continue;}}
var appendNode=node;if(Zapatec.is_ie&amp;&amp;node.nodeType==1&amp;&amp;node.nodeName.toLowerCase()=="</span>script<span class="literal">"){appendNode=node;}else{appendNode=node.cloneNode(true);}
labelEl.appendChild(appendNode);}
if(Zapatec.is_khtml){var allChildren=labelEl.all?labelEl.all:labelEl.getElementsByTagName("</span>*<span class="literal">");for(var ii=0;ii&lt;allChildren.length;ii++){var child=allChildren[ii];for(var jj=0;jj&lt;child.attributes.length;jj++){var attr=child.attributes[jj];child.setAttribute(attr.nodeName,attr.nodeValue.replace(/"</span>/g,<span class="literal">"'"</span>));}}}
struct[<span class="literal">'label'</span>]=labelEl.innerHTML;<span class="reserved">if</span>(Zapatec.is_opera){struct[<span class="literal">'label'</span>]=struct[<span class="literal">'label'</span>].replace(/\\<span class="literal">"/g,"</span><span class="literal">'");}
struct['</span>isSelected<span class="literal">']=liNode.className.match(/\bselected\b/)!=null;struct['</span>isExpanded<span class="literal">']=liNode.className.match(/\bexpanded\b/)!=null;struct['</span>loadAlways<span class="literal">']=liNode.className.match(/\bzpLoadAlways\b/)!=null;for(var ii=0;ii&lt;liNode.attributes.length;ii++){var attr=liNode.attributes[ii];if(Zapatec.is_ie&amp;&amp;liNode.getAttributeNode(attr.nodeName)&amp;&amp;!liNode.getAttributeNode(attr.nodeName).specified){continue;}
struct['</span>attributes<span class="literal">'][attr.nodeName.toLowerCase()]=attr.nodeValue;}
if(ul==null){if(icon){Zapatec.Utils.addClass(icon,"elementIcon");var tmpIcon=document.createElement("SPAN");tmpIcon.appendChild(icon);struct['</span>elementIcon<span class="literal">']=tmpIcon.innerHTML;}}else{if(expandedIcon){var tmpIcon=document.createElement("SPAN");tmpIcon.appendChild(expandedIcon);struct['</span>expandedIcon<span class="literal">']=tmpIcon.innerHTML;}
if(collapsedIcon){var tmpIcon=document.createElement("SPAN");tmpIcon.appendChild(collapsedIcon);struct['</span>collapsedIcon<span class="literal">']=tmpIcon.innerHTML;}
if(fetchingIcon){var tmpIcon=document.createElement("SPAN");tmpIcon.appendChild(fetchingIcon);struct['</span>fetchingIcon<span class="literal">']=tmpIcon.innerHTML;}
struct['</span>children<span class="literal">']=[];for(var ii=0;ii&lt;ul.childNodes.length;ii++){var tmp=Zapatec.Tree.Utils.convertLi2Json(ul.childNodes[ii],compat);if(tmp!=null){struct['</span>children<span class="literal">'].push(tmp);}}}
return struct;};Zapatec.Tree.Utils.xml2dom=function(node){if(node.nodeType==3){return document.createTextNode(node.nodeValue);}
if(node.nodeType!=1){return null;}
var el=Zapatec.Utils.createElement(node.nodeName);for(var ii=0;ii&lt;node.attributes.length;ii++){var attr=node.attributes[ii];if(attr.name.toLowerCase()=="class"){el.className=node.getAttribute(attr.name);}else{el.setAttribute(attr.name,node.getAttribute(attr.name));}}
if(node.hasChildNodes()){for(var ii=0;ii&lt;node.childNodes.length;ii++){var childNode=Zapatec.Tree.Utils.xml2dom(node.childNodes[ii]);if(childNode!=null){el.appendChild(childNode);}}}
return el;};Zapatec.Tree.Utils.convertXml2Json=function(itemNode){if(itemNode==null||itemNode.nodeType!=1||itemNode.nodeName.toLowerCase()!='</span>item<span class="literal">'){return null;}
var struct={content:null,attributes:{}};var list=null;var labelEl=document.createElement("span");for(var ii=0;ii&lt;itemNode.childNodes.length;ii++){var node=itemNode.childNodes[ii];if(node.nodeType!=1){continue;}
if(node.nodeName.toLowerCase()=="attribute"&amp;&amp;node.getAttribute("name")){struct.attributes[node.getAttribute("name")]=Zapatec.is_ie?node.childNodes[0].nodeValue:node.textContent;continue;}
if(node.nodeName.toLowerCase()=='</span>list<span class="literal">'){list=node;continue;}
if(node.nodeName.toLowerCase()=='</span>label<span class="literal">'){for(var jj=0;jj&lt;node.childNodes.length;jj++){labelEl.insertBefore(Zapatec.Tree.Utils.xml2dom(node.childNodes[jj]),labelEl.firstChild);}
continue;}}
struct['</span>label<span class="literal">']=labelEl.innerHTML;struct['</span>isSelected<span class="literal">']=itemNode.getAttribute("isSelected")=="true";struct['</span>isExpanded<span class="literal">']=itemNode.getAttribute("isExpanded")=="true";struct['</span>loadAlways<span class="literal">']=itemNode.getAttribute("loadAlways")=="true";struct['</span>source<span class="literal">']=itemNode.getAttribute("source");struct['</span>sourceType<span class="literal">']=itemNode.getAttribute("sourceType");if(list==null){struct['</span>elementIcon<span class="literal">']=itemNode.getAttribute("elementIcon");}else{struct['</span>collapsedIcon<span class="literal">']=itemNode.getAttribute("collapsedIcon");struct['</span>expandedIcon<span class="literal">']=itemNode.getAttribute("expandedIcon");struct['</span>fetchingIcon<span class="literal">']=itemNode.getAttribute("fetchingIcon");struct['</span>children<span class="literal">']=[];for(var ii=0;ii&lt;list.childNodes.length;ii++){var tmp=Zapatec.Tree.Utils.convertXml2Json(list.childNodes[ii]);if(tmp!=null){struct['</span>children<span class="literal">'].push(tmp);}}}
return struct;};Zapatec.Tree.Utils.getNodeIndex=function(node){if(!node||!node.config||!node.config.parentNode||!node.config.parentNode.children){return null;}
for(var ii=0;ii&lt;node.config.parentNode.children.length;ii++){if(node.config.parentNode.children[ii]==node){return ii;}}};Zapatec.Tree.Utils.getPrevNode=function(prevSelected){var index=Zapatec.Tree.Utils.getNodeIndex(prevSelected);if(index==null){return;}
var prevNode=null;if(index&gt;0){prevNode=prevSelected.config.parentNode.children[index-1];while(prevNode.hasSubtree()&amp;&amp;prevNode.data.isExpanded){prevNode=prevNode.children[prevNode.children.length-1];}}else if(!prevSelected.config.parentNode.config.isRootNode){prevNode=prevSelected.config.parentNode;}
return prevNode;};Zapatec.Tree.Utils.getNextNode=function(prevSelected){var index=Zapatec.Tree.Utils.getNodeIndex(prevSelected);if(index==null){return;}
var nextNode=null;if(prevSelected.hasSubtree()&amp;&amp;prevSelected.data.isExpanded&amp;&amp;prevSelected.children.length&gt;0){nextNode=prevSelected.children[0];}else if(index&lt;prevSelected.config.parentNode.children.length-1){nextNode=prevSelected.config.parentNode.children[index+1];}else if(!prevSelected.config.parentNode.config.isRootNode){nextNode=prevSelected.config.parentNode;index=Zapatec.Tree.Utils.getNodeIndex(nextNode);while(index==nextNode.config.parentNode.children.length-1){nextNode=nextNode.config.parentNode;if(nextNode.config.isRootNode){return;}
index=Zapatec.Tree.Utils.getNodeIndex(nextNode);}
nextNode=nextNode.config.parentNode.children[index+1];}
return nextNode;};Zapatec.Tree.Utils.addIconClass=function(str,className){if(!str||!className){return str;}
var md=str.match(/( class=['</span><span class="literal">"])/i);if(md){return str.replace(/( class=['"</span>])/i,<span class="literal">"$1"</span>+className+<span class="literal">" "</span>);}<span class="reserved">else</span>{<span class="reserved">return</span> str.replace(/^&lt;img/,<span class="literal">"&lt;img class='"</span>+className+<span class="literal">"'"</span>);}};Zapatec.Tree.Utils.isRightClick=<span class="reserved">function</span>(ev){<span class="reserved">if</span>(!ev){ev=window.event;}
<span class="reserved">if</span>(!ev){<span class="reserved">return</span> false;}
var button=ev.button?ev.button:ev.which
<span class="reserved">return</span>(button&gt;1||button==1&amp;&amp;(Zapatec.is_opera||Zapatec.is_khtml&amp;&amp;ev.metaKey));};</pre>
	<hr>



<!-- ========== START OF NAVBAR ========== -->
<a name="navbar_top"><!-- --></a>
<table border="0" width="100%" cellpadding="1" cellspacing="0">
<tr>
<td colspan=2 bgcolor="#EEEEFF" class="NavBarCell1">
<a name="navbar_top_firstrow"><!-- --></a>
<table border="0" cellpadding="0" cellspacing="3">
  <tr align="center" valign="top">
  
  
  <td bgcolor="#EEEEFF" class="NavBarCell1">    <a href="../../../zapatec/utils/jsdocs/overview-summary.html"><font class="NavBarFont1"><b>Overview</b></font></a>&nbsp;</td>
  <td bgcolor="#FFFFFF" class="NavBarCell1Rev">	&nbsp;<font class="NavBarFont1Rev"><b>File</b></font>&nbsp;</td>
  

  <td bgcolor="#FFFFFF" class="NavBarCell1"> <font class="NavBarFont1">Class</font>&nbsp;</td>
  <td bgcolor="#EEEEFF" class="NavBarCell1">    <a href="../../../zapatec/utils/jsdocs/overview-tree.html"><font class="NavBarFont1"><b>Tree</b></font></a>&nbsp;</td>
  <td bgcolor="#EEEEFF" class="NavBarCell1">    <a href="../../../zapatec/utils/jsdocs/index-all.html"--><font class="NavBarFont1"><b>Index</b></font></a>&nbsp;</td>
  <td bgcolor="#EEEEFF" class="NavBarCell1">    <a href="../../../zapatec/utils/jsdocs/help-doc.html"><font class="NavBarFont1"><b>Help</b></font></a>&nbsp;</td>
  </tr>
</table>
</td>
<td bgcolor="#EEEEFF" align="right" valign="top"><em>
<b>Zapatec Utils</b></em>
</td>
</tr>

<tr>
<td bgcolor="white" class="NavBarCell2"><font size="-2">
&nbsp;PREV&nbsp;
&nbsp;NEXT</font></td>
<td bgcolor="white" class="NavBarCell2"><font size="-2">
  <a href="../../../zapatec/utils/jsdocs/index.html" target="_top"><b>FRAMES</b></a>  &nbsp;
&nbsp;<a href="../../../zapatec/utils/jsdocs/overview-summary.html" target="_top"><b>NO FRAMES</b></a>
&nbsp;&nbsp;
<script>
  <!--
  if(window==top) {
    document.writeln('<A HREF="allclasses-noframe.html" TARGET=""><B>All Classes</B></A>');
  }
  //-->
</script>
<noscript>
<a href="../../../zapatec/utils/jsdocs/allclasses-noframe.html" target=""><b>All Classes</b></a>
</noscript>
</font></td>
</tr>
</table>
<!-- =========== END OF NAVBAR =========== -->

<hr>
<font size="-1">

</font>
<div class="jsdoc_ctime">Documentation generated by <a href="http://jsdoc.sourceforge.net/" target="_parent">JSDoc</a> on Thu Aug 16 12:18:39 2007</div>
</body>
</html>
